package com.wk.pms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wk.pms.entity.AttrAttrgroupRelation;
import com.wk.pms.mapper.AttrAttrgroupRelationMapper;
import com.wk.pms.service.AttrAttrgroupRelationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AttrAttrgroupRelationServiceImpl extends ServiceImpl<AttrAttrgroupRelationMapper, AttrAttrgroupRelation> implements AttrAttrgroupRelationService {

    @Override
    public void deleteRelation(List<AttrAttrgroupRelation> relationEntities) {
        relationEntities.forEach(relation->{
            baseMapper.delete(new QueryWrapper<AttrAttrgroupRelation>()
                    .eq("attr_id", relation.getAttrId())
                    .eq("attr_group_id", relation.getAttrGroupId()));
        });
    }
}
